<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增分机权限')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-power-add">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">分机号：</label>
                    <div class="col-sm-8">
                        <input name="extNum" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">业务组</label>
                    <div class="col-sm-8">
                        <select id="groupId" class="form-control select2-multiple" multiple>
                            <option th:each="bizGroup:${bizGroups}" th:value="${bizGroup.groupId}" th:text="${bizGroup.bizGroupName}" ></option>
                        </select>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var prefix = ctx + "cc/extpower"
        $("#form-power-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var data = $("#form-power-add").serializeArray();
                var groupIds = $.form.selectSelects("groupId");
                data.push({"name": "groupIds", "value": groupIds});
                $.operate.save(prefix + "/add", data);
            }
        }


        $(function() {
            $('#groupId').select2({
                placeholder: "请选择业务组",
                allowClear: true
            });
        })
    </script>
</body>
</html>